﻿$('.default_input_1').val(0);
$('.default_input_2').val(0);

$(function () {
    $(document).mousewheel(function (eventObj, responseKey) {
        var default_input_2_val = $('.default_input_2').val();
        if (default_input_2_val == 1) {
            return;
        }
        slideIndex(responseKey);
    });
    onclickPanelUpOrDown();
});

function slideIndex(a) {
    slideFloor(a);
    slidePanelUpOrDown(a);
    onclickPanelUpOrDown(a);
}

function slidePanelUpOrDown(a) {
    switch (a)
    {
        case -1:
            downPanel();
            break;
        case 1:
            upPanel();
            break;
    }
}

function onclickPanelUpOrDown(a) {
    var flag = true;
    $(".second-floor").on('click', function(){
        if(flag){
            downPanel();
            $('.slide-content').animate({
                'bottom': 545
            }, 200);
            flag = false;
        }else{
            upPanel();
            $('.slide-content').animate({
                'bottom': 0
            }, 200);
            flag = true;
        }
    })
}

function downPanel() {
    $(".second-floor").animate({
        "margin-top":"67px"
    }, 200, function () {
        $(".second-floor").text("一楼");
    });
}

function upPanel() {
    $(".second-floor").animate({
        "margin-top":"0px"
    }, 200, function () {
        $(".second-floor").text("二楼");
    })
}

function slideFloor(a) {
    var b= -1;
    switch (a){
        case -1:
            $('.default_input_1').val(b);
            var single_hh = 545;
            click_hh = -single_hh * b;
            $('.slide-content').animate({
                'bottom': click_hh
            }, 200);
            break;
        case 1:
            $('.default_input_1').val(b);
            var single_hh = 0;
            click_hh = -single_hh * b;
            $('.slide-content').animate({
                'bottom': click_hh
            }, 200);
            break;
    }
}